import time

from NanNing.common import RadarTEST
from NanNing.common import UdpClient
from NanNing.common.testData import FormatVal

if __name__ == '__main__':
    RadarTest1 = UdpClient()
    RadarTest2 = UdpClient()

    RadarTest1.connect(RadarTEST.HOST, RadarTEST.PORT1)
    RadarTest2.connect(RadarTEST.HOST, RadarTEST.PORT2)

    tag = 1  # 发送次数标记

    while tag < 11:
        print(f"-------------------------------------------------------------------------\n"
              f"第：{tag} 次发数据！")
        RadarTest1.set_data(FormatVal.NORMAL)
        RadarTest2.set_data(FormatVal.NORMAL)
        RadarTest1.main_send(is_send_sector=True, is_send_north=True)
        RadarTest2.main_send(is_send_sector=True, is_send_north=True)

        time.sleep(4)

        tag += 1

        print("\n\n")

    while True:
        print(f"-------------------------------------------------------------------------\n"
              f"第：{tag} 次发数据！")
        RadarTest1.set_data(FormatVal.Lost042And040)
        RadarTest2.set_data(FormatVal.NORMAL)
        RadarTest1.main_send(is_send_sector=True, is_send_north=True)
        RadarTest2.main_send(is_send_sector=True, is_send_north=True)

        time.sleep(4)

        tag += 1

        print("\n\n")
